home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / LANG / C / GCC / V2-4-5 / GPPLIBSR00 / cc / fstream < prev    next >
Text File  |  1993-08-04  |  2KB  |  66 lines

  1. //    This is part of the iostream library, providing input/output for C++.
  2. //    Copyright (C) 1991 Per Bothner.
  3. //
  4. //    This library is free software; you can redistribute it and/or
  5. //    modify it under the terms of the GNU Library General Public
  6. //    License as published by the Free Software Foundation; either
  7. //    version 2 of the License, or (at your option) any later version.
  8. //
  9. //    This library is distributed in the hope that it will be useful,
  10. //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. //    Library General Public License for more details.
  13. //
  14. //    You should have received a copy of the GNU Library General Public
  15. //    License along with this library; if not, write to the Free
  16. //    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  
  18. #define _STREAM_COMPAT
  19. #include "ioprivate.h"
  20. #ifdef __GNUG__
  21. #pragma implementation "fstream.h"
  22. #endif
  23. #include <fstream.h>
  24.  
  25. fstreambase::fstreambase()
  26. {
  27.     init(new filebuf());
  28. }
  29.  
  30. fstreambase::fstreambase(int fd)
  31. {
  32.     init(new filebuf(fd));
  33. }
  34.  
  35. fstreambase::fstreambase(const char *name, int mode, int prot)
  36. {
  37.     init(new filebuf());
  38.     if (!rdbuf()->open(name, mode, prot))
  39.     set(ios::badbit);
  40. }
  41.  
  42. void fstreambase::open(const char *name, int mode, int prot)
  43. {
  44.     clear();
  45.     if (!rdbuf()->open(name, mode, prot))
  46.     set(ios::badbit);
  47. }
  48.  
  49. void fstreambase::close()
  50. {
  51.     if (!rdbuf()->close())
  52.     set(ios::failbit);
  53. }
  54.  
  55. #if 0
  56. static int mode_to_sys(enum open_mode mode)
  57. {
  58.     return O_WRONLY;
  59. }
  60.  
  61. static char* fopen_cmd_arg(io_mode i)
  62. {
  63.     return "w";
  64. }
  65. #endif
  66.